package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 菜品口味信息持久层
 */
@Mapper
public interface DishFlavorMapper {

    /**
     * 新增菜品对应的口味信息
     * @param flavors
     */
    void insertFlavor(@Param("flavors") List<DishFlavor> flavors);

    /**
     * 删除菜品对应的口味信息
     * @param id
     */
    @Delete("delete from dish_flavor where dish_id = #{id}")
    void deleteFlavorByDishId(Long id);

    /**
     * 根据菜品id 查询对应的口味信息
     * @param id
     * @return
     */
    @Select("select * from  dish_flavor where dish_id = #{id}")
    List<DishFlavor> selectFlavorByDishId(Long id);
}
